package cn.dnui_wnx725.dnuifood_16110100725.fragment;

import android.content.Intent;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;

import cn.dnui_wnx725.dnuifood_16110100725.R;
import cn.dnui_wnx725.dnuifood_16110100725.controller.LoginActivity;
import cn.dnui_wnx725.dnuifood_16110100725.controller.UpdateInfoActivity;

/**
 * A simple {@link Fragment} subclass.
 */
public class MyFragment extends BaseFragment {
    private Button btn_logout,btn_alter;


    @Override
    void initView() {
        btn_alter=view.findViewById(R.id.btn_alter);
        btn_logout=view.findViewById(R.id.btn_logout);

    }

    @Override
    void initEvent() {
        btn_alter.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                startActivity(new Intent(getActivity(), UpdateInfoActivity.class));
            }
        });
        btn_logout.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                startActivity(new Intent(getActivity(), LoginActivity.class));
                getActivity().onBackPressed();
            }
        });

    }

    @Override
    void initData() {

    }

    public MyFragment() {
        // Required empty public constructor
    }


    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {
        // Inflate the layout for this fragment
        setLayout_file(R.layout.fragment_my);
        return super.onCreateView(inflater,container,savedInstanceState);
    }

}
